﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xts
{
    namespace XInterBank
    {
        namespace MarketData
        {
            [Serializable]
            public class XSnapshotDataEventArgs : EventArgs
            {
                private XBondSnapshotData x_snapshotData;
                public XSnapshotDataEventArgs(XBondSnapshotData snapshotData)
                {
                    x_snapshotData = snapshotData;
                }

                public XBondSnapshotData Snapshot
                {
                    get { return x_snapshotData; }
                    set { x_snapshotData = value; }
                }
            }

            [Serializable]
            public class XQuoteDetailDataEventArgs : EventArgs
            {
                private XBondQuoteDetailData x_quoteDetailData;
                public XQuoteDetailDataEventArgs(XBondQuoteDetailData quoteDetailData)
                {
                    x_quoteDetailData = quoteDetailData;
                }

                public XBondQuoteDetailData QuoteDetail
                {
                    get { return x_quoteDetailData; }
                    set { x_quoteDetailData = value; }
                }
            }

            [Serializable]
            public class XSnapshotDataEventHandler : IXSnapshotDataHandler
            {
                public EventHandler<XSnapshotDataEventArgs> SnapshotReached;

                public XSnapshotDataEventHandler() { }

                public void OnNewSnapshot(XBondSnapshotData snapshotData)
                {
                    EventHandler<XSnapshotDataEventArgs> handler = SnapshotReached;
                    if(handler != null)
                    {
                        handler(this, new XSnapshotDataEventArgs(snapshotData));
                    }
                }
            }

            [Serializable]
            public class XQuoteDetailDataEventHandler : IXQuoteDetailDataHandler
            {
                public EventHandler<XQuoteDetailDataEventArgs> QuoteDetailReached;

                public XQuoteDetailDataEventHandler() { }

                public void OnNewQuoteDetailData(XBondQuoteDetailData quoteDetailData)
                {
                    EventHandler<XQuoteDetailDataEventArgs> handler = QuoteDetailReached;
                    if(handler != null)
                    {
                        handler(this, new XQuoteDetailDataEventArgs(quoteDetailData));
                    }
                }
            }
        }
    }
}